package com.coolweather.android.broadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.coolweather.android.bean.EventBean;
import com.coolweather.android.util.HttpUtil;
import com.coolweather.android.util.LogUtils;

import de.greenrobot.event.EventBus;

/**
 * Created by Administrator on 2017/8/24.
 */

public class NetBroadCastReciver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if(HttpUtil.isNetAvailable(context)){
            LogUtils.d("isnetwork_broadcast","有网aaaa");
            EventBus.getDefault().post(new EventBean("有网"));//event发送事件
        }else{
            LogUtils.d("isnetwork_broadcast","没网bbbb");
            EventBus.getDefault().post(new EventBean("没网"));//event发送事件
        }
    }
}
